Hello, I am working on creating a dxl script to import an Excel spreadsheet into Doors. This spreadsheet contains some cells with strikethrough text. I do not want any strikethrough text copied into Doors. How do I determine if a cell is formatted as strikethrough? Or maybe there is a way to import rich text and pull the strikethrough property from that. Any suggestions would be greatly appreciated. bburk88 - Thu Aug 07 11:25:26 EDT 2014 |
Re: Import Excel with strikethrough Does your script get an OLE "handle" on Excel, and then send Excel commands? i,e, do you have something like this in the code:
If so, I think it is easier to get the raw text then get the rich text. One of the cell "methods" does that. I don't recall, but maybe methods "Text" as opposed to "Value". In any event, if you read the contents of a cell into a variable, you can strip out all rich text (including strikethroughs):
-Louie |
Re: Import Excel with strikethrough llandale - Thu Aug 07 13:16:03 EDT 2014 Does your script get an OLE "handle" on Excel, and then send Excel commands? i,e, do you have something like this in the code:
If so, I think it is easier to get the raw text then get the rich text. One of the cell "methods" does that. I don't recall, but maybe methods "Text" as opposed to "Value". In any event, if you read the contents of a cell into a variable, you can strip out all rich text (including strikethroughs):
-Louie Hey Louie, I was under the impression that the raw text is basically rich text with everything stripped out except the text. |
Re: Import Excel with strikethrough bburk88 - Thu Aug 07 13:52:13 EDT 2014 Hey Louie, I was under the impression that the raw text is basically rich text with everything stripped out except the text. Yes. And tools can look at the RichText or HTML or whatever and tell the difference. Doors lets you extract just the raw text from attributes>
Excell lets you do that also. And above is a function to do it. -Louie |
Re: Import Excel with strikethrough llandale - Thu Aug 07 13:16:03 EDT 2014 Does your script get an OLE "handle" on Excel, and then send Excel commands? i,e, do you have something like this in the code:
If so, I think it is easier to get the raw text then get the rich text. One of the cell "methods" does that. I don't recall, but maybe methods "Text" as opposed to "Value". In any event, if you read the contents of a cell into a variable, you can strip out all rich text (including strikethroughs):
-Louie I guess I wasn't very clear in my initial question. I want to be able to know if a cell in Excel is formatted as StrikeThrough. That way I can disregard any text that I find in that cell. Is there a way to check the Cell properties to see if StrikeThrough is selected? |
Re: Import Excel with strikethrough bburk88 - Fri Aug 08 13:29:09 EDT 2014 I guess I wasn't very clear in my initial question. I want to be able to know if a cell in Excel is formatted as StrikeThrough. That way I can disregard any text that I find in that cell. Is there a way to check the Cell properties to see if StrikeThrough is selected? I'm not good at OLE queries. But the "Cell" would not have a "strikethrough" property. You'd need to get a handle of the various "text" chunks and query the "Font" properties. It may be easier to read the rich text contents and then query your dxl variable:
Here is a good place to go for Excel VBA; here we can see a list of Properties and Methods. Other places you need to go to the Object first; which makes it tough if you know you want something about "Italic" but don't know the Object to which it applies. http://msdn.microsoft.com/en-us/library/aa269683(v=office.10).aspx This is old Office-XP and won't have the few things added to Excel in the last several years. Sure enough we find "Italic" under "Properties"; see that it applies to "Font". Lookup "Font" to see where it comes from ... backtrack up to a "Cell". -Louie |
Re: Import Excel with strikethrough llandale - Fri Aug 08 14:11:02 EDT 2014 I'm not good at OLE queries. But the "Cell" would not have a "strikethrough" property. You'd need to get a handle of the various "text" chunks and query the "Font" properties. It may be easier to read the rich text contents and then query your dxl variable:
Here is a good place to go for Excel VBA; here we can see a list of Properties and Methods. Other places you need to go to the Object first; which makes it tough if you know you want something about "Italic" but don't know the Object to which it applies. http://msdn.microsoft.com/en-us/library/aa269683(v=office.10).aspx This is old Office-XP and won't have the few things added to Excel in the last several years. Sure enough we find "Italic" under "Properties"; see that it applies to "Font". Lookup "Font" to see where it comes from ... backtrack up to a "Cell". -Louie All you have to do is get the font for the cell and see if it's underline property is set to true. If objCell is the handle to the cell and objFont is defined as an OleAutoObj, and bUnderline declared as a bool: oleGet(objCell, "Font", objFont) oleGet(objFont, "Underline", bUnderline) if (!bUnderline) { ... process the cell } |
Re: Import Excel with strikethrough Ok I finally figured it out.
clear(AutoArgs) |
Re: Import Excel with strikethrough bburk88 - Fri Aug 08 15:39:47 EDT 2014 Ok I finally figured it out.
clear(AutoArgs) Try your code to see what happens when just part of the text is strikethrough. |